<template>
  <div>
    <h1>vant</h1>
    <van-button @click="myget" type="primary">主要按钮GET</van-button>
    <van-button @click="mypost" type="info">信息按钮POST</van-button>
    <van-button @click="mymock" type="default">默认按钮mock</van-button>
    <van-button type="warning">警告按钮</van-button>
    <van-button type="danger">危险按钮</van-button>
    <van-cell title="选择多个日期" :value="text" @click="show = true" />
    <van-calendar v-model="show" type="multiple" @confirm="onConfirm" />
  </div>
</template>

<script>
const axios = require("axios");

import "@/mock";

export default {
  data() {
    return {
      text: "",
      show: false,
    };
  },
  methods: {
    
    mymock() {
      console.log('mock');
      axios
        .get("/mock/test")
        .then((res) => {
          console.log(res);
        })
        .catch((err) => {
          console.log(err);
        });
    },
    myget() {
      axios
        .get("http://sky.nnzhp.cn/api/sparrow/student")
        .then(function (response) {
          // handle success
          console.log(response);
        })
        .catch(function (error) {
          // handle error
          console.log(error);
        })
        .then(function () {
          // always executed
        });
    },
    mypost() {
      axios
        .post("http://sky.nnzhp.cn/api/user/register", {
          phone: "15375337875",
          email: "2017133352@qq.com",
          nick: "web2",
          password: "111",
          password2: "111",
        })
        .then(function (response) {
          console.log(response);
        })
        .catch(function (error) {
          console.log(error);
        });
    },
    onConfirm(date) {
      this.show = false;
      this.text = `选择了 ${date.length} 个日期`;
    },
  },
};
</script>

<style>
</style>